package com.jia.leetCode;

/**
 * @program: Leetcode
 * @description:  476. Number Complement
 * @author: STU756
 * @create: 2020-08-16 21:34
 */
public class Pro0476 {
    public int findComplement(int num) {
        int ans = 0, t = 0;
        while(num != 0) {
            ans += ((num & 1)^1) << t;
            num >>= 1;
            ++t;
        }
        return ans;
    }
}
